package com.huatai.datacenter.entity.datamodel;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author gusiyi
 * @version 1.0
 * @className DataModelEntity
 * @description 描述：
 * @date 2023/5/25 17:06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tb_data_model",autoResultMap = true)
@ApiModel(value = "数据模型实体类",description = "数据模型实体类")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DataModelEntity extends DataModelBaseEntity{


	@TableId(value = "id",type = IdType.ASSIGN_ID)
	@ApiModelProperty(value = "数据模型id",required = true)
	@NotNull(message = "修改时模型id必传")
	private Long id;

	@ApiModelProperty(value = "数据模型名称",required = true)
	private String dataModelName;

	@ApiModelProperty(value = "数据模型类型id",required = true)
	private Long dataModelTypeId;

	@ApiModelProperty(value = "数据模型类型名称",required = true)
	private String dataModelTypeName;

	@ApiModelProperty(value = "备注")
	private String remark;

	@TableField(exist = false)
	@ApiModelProperty(value = "数据模型字段集合",required = true)
	private List<DataModelFieldEntity> fields;

	@ApiModelProperty("示例数据")
	@TableField(typeHandler = JacksonTypeHandler.class)
	private JSONObject examples;
}
